﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Gds.TaskFunction.TestFunction
{
    /// <summary>
    /// 通用工具类
    /// </summary>
    public static class PublicFunctionTool
    {
        public static void AddLog(string msg)
        {
            ViewModel.pageViewModel.MainViewModel.Instance.AddLogModel(msg);
        }
        public static void AddCommuLog(string msg,int _totalLine,int _controller)
        {
            ViewModel.pageViewModel.CommunicationLogViewModel.Instance.AddLogModel(msg,_totalLine, _controller);
        }
        public static bool UpDateRealTimePotencyData(string serialNo, string gasValue, string gasErrorFlag, string GasState)
        {
            bool result = true;
            try
            {
                List<object> tmpselectkeyList = new List<object>();
                List<object> tmpselectvalueList = new List<object>();
                List<object> tmpinsertkeyList = new List<object>();
                List<object> tmpinsertvalueList = new List<object>();
                tmpselectkeyList.Add("GasSerialNo");
                tmpselectvalueList.Add(serialNo);

                tmpinsertkeyList.Add("GasState");
                tmpinsertvalueList.Add(GasState);

                tmpinsertkeyList.Add("GasErrorFlag");
                tmpinsertvalueList.Add(gasErrorFlag);

                tmpinsertkeyList.Add("GasValue");
                tmpinsertvalueList.Add(gasValue);
                Utility.Helper.DataBaseHelper.UpDateModel<Model.ConfigModel.RealTimeModel.RealTimeGasPotencyModel>("RealTimeGasPotencyData", tmpselectkeyList, tmpselectvalueList
                                                                                                              , tmpinsertkeyList, tmpinsertvalueList);


            }
            catch (Exception ex)
            {
                Utility.Helper.PublicHelper.WriteErrorMsg(ex);
                result = false;
            }
            return result;

        }
    }
}
